package com.ugoodtech.mdcc.core.repository;

import com.ugoodtech.mdcc.core.domain.Question;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

public interface QuestionRepository extends PagingAndSortingRepository<Question, Long>
        , QueryDslPredicateExecutor<Question> {

    @Query(value = "select count(*) from questions where group_id=:groupId and deleted=false and enabled=true", nativeQuery = true)
    Object countQuestionNum(@Param("groupId") Long groupId);

}
